# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1RaySpec do
  @moduledoc """
  Configuration information for the Ray cluster. For experimental launch, Ray cluster creation and Persistent cluster creation are 1:1 mapping: We will provision all the nodes within the Persistent cluster as Ray nodes.

  ## Attributes

  *   `headNodeResourcePoolId` (*type:* `String.t`, *default:* `nil`) - Optional. This will be used to indicate which resource pool will serve as the Ray head node(the first node within that pool). Will use the machine from the first workerpool as the head node by default if this field isn't set.
  *   `imageUri` (*type:* `String.t`, *default:* `nil`) - Optional. Default image for user to choose a preferred ML framework (for example, TensorFlow or Pytorch) by choosing from [Vertex prebuilt images](https://cloud.google.com/vertex-ai/docs/training/pre-built-containers). Either this or the resource_pool_images is required. Use this field if you need all the resource pools to have the same Ray image. Otherwise, use the {@code resource_pool_images} field.
  *   `rayLogsSpec` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1RayLogsSpec.t`, *default:* `nil`) - Optional. OSS Ray logging configurations.
  *   `rayMetricSpec` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1RayMetricSpec.t`, *default:* `nil`) - Optional. Ray metrics configurations.
  *   `resourcePoolImages` (*type:* `map()`, *default:* `nil`) - Optional. Required if image_uri isn't set. A map of resource_pool_id to prebuild Ray image if user need to use different images for different head/worker pools. This map needs to cover all the resource pool ids. Example: { "ray_head_node_pool": "head image" "ray_worker_node_pool1": "worker image" "ray_worker_node_pool2": "another worker image" }
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :headNodeResourcePoolId => String.t() | nil,
          :imageUri => String.t() | nil,
          :rayLogsSpec =>
            GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1RayLogsSpec.t() | nil,
          :rayMetricSpec =>
            GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1RayMetricSpec.t() | nil,
          :resourcePoolImages => map() | nil
        }

  field(:headNodeResourcePoolId)
  field(:imageUri)
  field(:rayLogsSpec, as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1RayLogsSpec)
  field(:rayMetricSpec, as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1RayMetricSpec)
  field(:resourcePoolImages, type: :map)
end

defimpl Poison.Decoder, for: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1RaySpec do
  def decode(value, options) do
    GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1RaySpec.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1RaySpec do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
